<template>
  <div class="f-wrap">
    <div class="f-head">
      <van-row>
        <van-col span="12">
          <div class="f-r-title">发现</div>
        </van-col>
        <van-col span="12">
          <div class="f-r-img">
            <img src="@img/msg.png" alt="" />
          </div>
        </van-col>
      </van-row>
    </div>
    <div class="cont">
      <van-row gutter="13" style="margin-bottom: 13px">
        <van-col span="12">
          <div class="to-shop">
            <div class="to-cont">
              <div class="head">积分商城</div>
              <div class="gotoBtn">
                <span>去兑换</span>
              </div>
            </div>
          </div>
        </van-col>
        <van-col span="12">
          <div class="go-cj">
            <div class="to-cont">
              <div class="head">抽奖中心</div>
              <div class="gotoBtn" @click="toCj">
                <span>去抽奖</span>
              </div>
            </div>
          </div>
        </van-col>
        <van-col span="24" v-if="false">
          <div class="go-cj1">
            <div class="to-cont1">
              <div class="head1">抽奖中心</div>
              <div class="gotoBtn1" @click="toCj">
                <span>去抽奖</span>
              </div>
            </div>
          </div>
        </van-col>
        <van-col span="24" v-if="false">
          <div class="go-cj1 dh">
            <div class="to-cont1">
              <div class="head1">兑换商城</div>
              <div class="gotoBtn1">
                <span>去兑换</span>
              </div>
            </div>
          </div>
        </van-col>
      </van-row>
      <div class="cont-item">
        <div class="func">
          <div class="func-item" :style="itemStyle" v-for="i in 10" :key="i">
            <img src="@img/kcmc.png" />
            <span>课程名称</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script name="FindIndex" setup>
import { computed } from "vue";
import { useRouter } from "vue-router";
const router = useRouter();
const props = defineProps({
  col: {
    type: [String, Number],
    default: 4,
  },
});

const itemStyle = computed(() => {
  const { col } = props;
  return {
    width: (100 / col) * 1 + "%",
  };
});
const toCj = () => {
  router.push({
    path: "/lottery",
  })
}
</script>

<style scoped lang="scss">
.f-wrap {
  background: #f4f8ff;
  .f-head {
    background: #ffffff;
    padding: 0 15px;
    height: 40px;
    line-height: 40px;
    .f-r-title {
      font-family: PingFangSC, PingFang SC;
      font-weight: 500;
      font-size: 20px;
      color: #171a1d;
      text-align: left;
      font-style: normal;
    }
    .f-r-img {
      text-align: right;
      img {
        width: 24px;
        height: 24px;
        vertical-align: middle;
      }
    }
  }
  .cont {
    padding: 10px 16px;
    .to-shop {
      height: 87px;
      width: 100%;
      border-radius: 4px;
      background: url("@img/scbg.png") no-repeat;
      background-size: 100% 100%;
    }
    .go-cj {
      height: 87px;
      width: 100%;
      border-radius: 4px;
      background: url("@img/cjbg.png") no-repeat;
      background-size: 100% 100%;
    }
    .dh {
      background: url("@img/dh1.png") no-repeat;
    }
    .go-cj1 {
      height: 87px;
      width: 100%;
      border-radius: 4px;
      background: url("@img/cjzx1.png") no-repeat;
      background-size: 100% 100%;
      .to-cont1 {
        position: relative;
        .head1 {
          padding: 30px 109px;
          font-family: PingFangSC, PingFang SC;
          font-weight: 500;
          font-size: 20px;
          color: #ffffff;
          line-height: 28px;
          text-align: left;
          font-style: normal;
        }
        .gotoBtn1 {
          position: absolute;
          top: 36px;
          right: 18px;
          span {
            border-radius: 9px;
            border: 1px solid #b74f2c;
            display: inline-block;
            padding: 2px 9px;
            font-family: PingFangSC, PingFang SC;
            font-weight: 400;
            font-size: 10px;
            color: #b74f2c;
            line-height: 14px;
            text-align: left;
            font-style: normal;
          }
        }
      }
    }
    .to-cont {
      padding: 22px 16px 20px 16px;
      .head {
        font-family: PingFangSC, PingFang SC;
        font-weight: 500;
        font-size: 16px;
        color: #ffffff;
        line-height: 22px;
        text-align: left;
        font-style: normal;
        padding-bottom: 7px;
      }
      .gotoBtn {
        border-radius: 9px;
        border: 1px solid #b74f2c;
        display: inline-block;
        padding: 2px 9px;
        font-family: PingFangSC, PingFang SC;
        font-weight: 400;
        font-size: 10px;
        color: #b74f2c;
        line-height: 14px;
        text-align: left;
        font-style: normal;
      }
    }
    .cont-item {
      background: #ffffff;
      border-radius: 8px;
      padding: 19px 7px;
      .func {
        display: flex;
        flex-wrap: wrap;
        &-item {
          display: flex;
          flex-direction: column;
          align-items: center;
          margin-bottom: 20px;
          img {
            width: 40px;
            height: 40px;
            border-radius: 12px;
          }
          span {
            font-family: PingFangSC-Regular;
            font-size: 12px;
            color: #676b6b;
            text-align: center;
            padding-top: 8px;
          }
        }
      }
    }
  }
}
</style>
